<style type="text/css">
    .header {
        text-align: center;
        border-left: 1px solid #eaeff0;
        border-top: 1px solid #eaeff0;
        border-bottom: 1px solid #eaeff0;
        padding: 8px 0px;
        background-color: #ffffff;
        color: #58666e
    }

    .content_style {
        text-align: center;
        border-left: 1px solid #eaeff0;
        border-bottom: 1px solid #eaeff0;
    }

    .padding8_10 {
        padding: 8px 10px;
    }

    .btn-style {
		background-color: #edf1f2;
		margin-bottom: 4px;
		width: 24px;
		height: 22px;
	}

    .under-line {
        text-decoration: underline;
        color: rgb(41, 158, 236);
    }
</style>
<div class="col-sm-12 mt20">

    <div class="panel">
        <div class="panel-body">
            <div class="col-sm-10 control-label" style="font-size: 15px; margin-top: 8px">
                <label class="col-sm-3 control-label">机构名称 :
                    <strong class="ng-binding">{{officeInfo.company_name}}</strong>
                </label>
                <label class="col-sm-3 control-label">机构编号 :
                    <strong class="ng-binding">{{officeInfo.company_code}}</strong>
                </label>
                <label class="col-sm-3 control-label" 
                ng-show="officeInfo.platform_product_flag == 0 && officeInfo.sys_area != officeInfo.company_code">自动获取公开产品
                    <button type="button" class="btn btn-default btn-xs btn-style" ng-model="officeInfo.automatic_save" 
                    btn-checkbox="" btn-checkbox-true="'1'" btn-checkbox-false="'0'" ng-click="autoSave()">
                        <i class="fa fa-check text-active"></i>
                    </button>
                </label>
            </div>

        </div>
    </div>

    <div class="panel panel-default">
        <div class="panel-body">
            <div class="col-lg-3">
                <input type="text" class="form-control" placeholder="产品名称" ng-model="searchform.name">
            </div>
            <div class="col-lg-3">
                <input type="text" class="form-control" placeholder="产品编号" ng-model="searchform.sale_code">
            </div>
            <!-- <div class="col-lg-2-4">
				<ui-select ng-model="searchform.place_code" theme="bootstrap">
					<ui-select-match placeholder="请选择一个景区">
						{{$select.selected.name}}
					</ui-select-match>
					<ui-select-choices repeat="item.place_code as item in ptp_place_list | filter: $select.search">
						<span ng-bind-html="item.name | highlight: $select.search"></span>
					</ui-select-choices>
				</ui-select>
			</div> -->
            <div class="col-lg-2-4">
                <ui-select ng-model="searchform.sale_category" theme="bootstrap">
                    <ui-select-match placeholder="产品分类">
                        {{$select.selected.label}}
                    </ui-select-match>
                    <ui-select-choices repeat="item.value as item in sale_category | filter: $select.search">
                        <span ng-bind-html="item.label | highlight: $select.search"></span>
                    </ui-select-choices>
                </ui-select>
            </div>
            <div class="col-lg-2-4">
                <ui-select ng-model="searchform.nothave" theme="bootstrap">
                    <ui-select-match placeholder="采购分类">
                        {{$select.selected.name}}
                    </ui-select-match>
                    <ui-select-choices repeat="item.value as item in nothave | filter: $select.search">
                        <span ng-bind-html="item.name | highlight: $select.search"></span>
                    </ui-select-choices>
                </ui-select>
            </div>
            <div class="col-lg-1">
                <button class="btn btn-info " ng-click="search(currentPage)">立即搜索</button>
            </div>
        </div>

        <div class="panel-body">
            <table class="table table-bordered">
                <thead>
                    <th style="min-width: 200px;">基本信息</th>
                    <th style="width: 135px;">价格</th>
                    <th class="text-center" style="width: 111px;">有效期</th>
                    <th style="width: 90px;">产品状态</th>
                    <th style="width: 90px;">是否采购</th>
                    <th>售卖渠道
                        <a class="btn btn-link under-line" style="padding: 0px 5px; vertical-align: baseline;" ng-click="myChannel()">默认渠道</a>
                    </th>
                    <th style="width: 103px;">公开销售</th>
                    <!-- <th style="width: 70px;">操作</th> -->
                </thead>
                <tbody>
                    <tr ng-repeat="info in sale_list" ng-if="!loading">
                        <td>
                            产品名称 : {{info.name}}
                            <br/>产品编号 : {{info.code}}
                            <br> 产品分类：{{info.sale_category_name}}
                            <br> <strong>供应商名：{{info.downstream_company_name}}</strong>
                            <!-- <br/> 成本价：{{info.cost_price}} 元 / 指导价：{{info.guide_price}} 元 / 市场价：{{info.market_price}} 元 -->
                        </td>
                        <td>
                            分销价：<span><strong style="color: red;">{{info.cost_price}}</strong></span> 元
                            <br /> 指导价：<span><strong style="color: red;">{{info.guide_price}}</strong></span> 元
                            <br />市场价：<span>{{info.market_price}}</span> 元
                        </td>
                        <td class="text-center">
                            {{info.periodstart}}
                            <br />至
                            <br />{{info.periodend}}
                        </td>
                        <td>
                            {{info.sale_apply_state_name}}
                            <br/> {{info.state_name}}
                        </td>
                        <td>
                            <br/>
                            <label class="i-switch bg-success" style="margin-left: 12px;">
                                <input ng-disabled="info.type == '1'" type="checkbox" ng-model="info.is_selected" ng-change="change1(info.code, info.type, info.is_selected, $index)">
                                <i></i>
                            </label>
                        </td>
                        <td>
                            <span ng-if="info.state == '1'" ng-bind-html="info.channel_list_name"></span><br ng-show="info.channel_list_name"/>
                            <a ng-if="info.state == '1'" class="btn btn-xs btn-link under-line" ng-click="setChannel(info)">设置渠道</a>
                        </td>
                        <td>
                            <label ng-if="info.state == '1'" class="i-switch bg-success" style="margin-left: 15px;">
                                <input type="checkbox" ng-model="info.is_selected3" ng-change="change2(info, info.is_selected3, $index)">
                                <i></i>
                            </label>
                            <br>
                            <a ng-if="info.state == '1'" class="btn btn-xs btn-link under-line" ng-click="setFxs(info)">设置分销商</a>
                        </td>
                        <!-- <td> -->
                            <!-- <button type="button" ng-if="info.state == 0" style="margin-top: 18px" class="btn btn-info btn-xs" ng-click="addToMy(info.code)">添加到产品库</button> -->
                            <!-- <button ng-if="info.is_selected" type="button" class="btn btn-info btn-xs" ng-click="PtPgrant(info)">授权</button> -->
                            <!-- <button ng-if="info.state == '1'" type="button" class="btn btn-info btn-xs" ng-click="setChannel(info)">售卖渠道</button> -->
                        <!-- </td> -->
                    </tr>
                </tbody>
            </table>
            <div class="text-right" ng-if="!loading">
                <pagination total-items="totalItems" ng-model="currentPage" ng-change="search(currentPage)" previous-text="上一页" next-text="下一页"
                    first-text="首页" last-text="尾页" max-size="5" boundary-links="true" rotate="false" items-per-page="itemsPerPage"
                    class="m-b" style="margin-top: 30px">
                </pagination>
            </div>

        </div>
    </div>

</div>